/**
 * \file OgreBillboadChain.h
 * \author Niels van Galen Last & Erik Kok
 * \date 01-15-08
 */
#ifndef _BillboardChain_H__
#define _BillboardChain_H__

#include "OgrePrerequisites.h"

#include "OgreSimpleRenderable.h"

namespace Ogre {

   class BillboardChainElement
   {

   public:

      BillboardChainElement();

      BillboardChainElement(Vector3 position,
                       Real width,
                       Real uTexCoord,
                       ColourValue colour);

      Vector3 position;
      Real width;
      Real uTexCoord;
      ColourValue colour;

   };

    /** Allows the rendering of a chain of connected billboards.
    */
   class /*_OgreExport*/ BillboardChain : public SimpleRenderable
   {

   public:
         
      typedef std::vector<BillboardChainElement> BillboardChainElementList;

      BillboardChain(int maxNbChainElements = 10);
      virtual ~BillboardChain();

        virtual void _notifyCurrentCamera(Camera* cam);
      virtual Real getSquaredViewDepth(const Camera* cam) const;
        virtual Real getBoundingRadius(void) const;

      void setNbChainElements(unsigned int nbChainElements);
      void setChainElement(unsigned int elementIndex, const BillboardChainElement& billboardChainElement);
      void updateBoundingBox();

   protected:

      Real mRadius;

      int mCurrentNbChainElements;
      int mMaxNbChainElements;

      BillboardChainElementList mChainElementList;

      void updateHardwareBuffers();
   };

} // namespace

#endif
